//1,下载路由vue-router===>`npm i vue-router`
//2，引入路由
import VueRouter from "vue-router";
import Vue from "vue";
//3,注册全局组件
Vue.use(VueRouter)
//4,设置路由规则
const routes = [
    {
        path: '/',
        redirect: '/login'//重定向
    },
    {
        path: '/login',
        name: 'login',
        component: () => import("../views/login.vue")
    },
    // 注册页面路由的配置
    {
        path: "/register",
        name: "register",
        component: () => import("../views/register.vue")
    },
    // 个人中心的路由配置
    // @表示src文件夹
    {
        path: "/personal",
        name: 'personal',
        component: () => import("@/views/personal.vue")
    },
    // 个人中心编辑页面的完成
    {
        path: "/edit_profile",
        name: "edit_profile",
        component: () => import("@/views/edit_profile")
    },
    // 首页路由
    {
        path: "/index",
        name: "index",
        component: () => import("@/views/index")
    },
    // 文章详情页面
    {
        path: "/articleDetail",
        name: "articleDetail",
        component: () => import("../views/articleDetail.vue")
    },//评论列表页面
    {
        path: "/comment",
        name: "comment",
        component: () => import("../views/comment.vue")
    }

]
//5,用路由规则生成路由对象
const router = new VueRouter({
    routes: routes
})

//6,导出生成的路由对象，让其挂载在Vue中
export default router